package com.hqyj.springBoot.config.pay;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yun
 * @date 2021-5-9 19:39
 */
@Configuration
public class AliPayConfig {
    @Autowired
    private AliPayConfigBean aliPayConfigBean;

    @Bean
    public AlipayClient alipayClient () {
        return new DefaultAlipayClient(
                aliPayConfigBean.getAlipayGateway(),
                aliPayConfigBean.getAppId(),
                aliPayConfigBean.getPrivateKey(),
                aliPayConfigBean.getFormat(),
                aliPayConfigBean.getCharset(),
                aliPayConfigBean.getAlipayPublicKey(),
                aliPayConfigBean.getSignType());
    }
}
